package com.itheima.string;

import java.util.Scanner;

public class DemoSubstring {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);//录入字符串,用Scanner实现
        System.out.println("请输入手机号");
        String s = sc.nextLine();
        String infront = s.substring(0, 3);//截取前三位(包含头不含尾)
        String behind = s.substring(s.length() - 4);//截取后四位;
        System.out.println(infront + "****" + behind);
        String  str = "键盘敲烂,月薪过万";
        String substring = str.substring(str.length() - 4);
        System.out.println(substring);
    }
}